package Text1;

import java.util.*;

public class Main {
    static final int N = 100010;
    static int[] q=new int[N];

    //    给定你一个长度为 n的整数数列。请你使用归并排序对这个数列按照从小到大进行排序。
//    并将排好序的数列按顺序输出。
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n=scanner.nextInt();
        for (int i = 0; i < n; i++) {
            q[i]=scanner.nextInt();
        }
        m_qsrt(0,n-1);
        for (int i = 0; i < n; i++) {
            System.out.print(q[i]+" ");
        }
    }

    private static void m_qsrt(int l, int r) {
        if(l>=r){
            return;
        }
        int mid=l+r>>1;
        m_qsrt(l,mid);
        m_qsrt(mid+1,r);
        int k=0,i=l,j=mid+1;
        int[] tmp = new int[r - l + 1];
        while(i<=mid&&j<=r){
            if(q[i]<q[j]){
               tmp[k++]=q[i++];
            }else{
                tmp[k++]=q[j++];
            }
        }
        while(i<=mid){
            tmp[k++]=q[i++];
        }
        while(j<=r){
            tmp[k++]=q[j++];
        }
        for (int m = 0; m < tmp.length; m++) {
            q[l+m]=tmp[m];
        }
    }
}
